import java.util.Scanner;

public class Test01 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();

        int[] arr1 = new int[n];
        for (int i = 0; i < n; i++) {
            arr1[i] = scanner.nextInt();
        }
        int[] arr2 = new int[n];
        for (int i = 0; i < n; i++) {
            arr2[i] = scanner.nextInt();
        }

        int minTime = Integer.MAX_VALUE;

        //使用同一台面包机
        for (int i = 0; i < n; i++) {
            minTime = Math.min(minTime , arr1[i] + arr2[i]);
        }
        //同时进行
        int minA = Integer.MAX_VALUE;
        int minB = Integer.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            minA = Math.min(minA , arr1[i]);
            minB = Math.min(minB , arr2[i]);
        }

        minTime = Math.min(minTime , Math.max(minA, minB));
        System.out.println(minTime);
    }
}
